﻿ 
<!DOCTYPE html>  
<html>  
<head>  
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">  
    <meta name="keywords" content="职位">  
    <meta name="description" content="职位">  
    <title>职位管理</title>  
    
    <%@ include file="/WEB-INF/inc/default.jsp"%>
    <jsp:include page="/WEB-INF/inc/dic.jsp"/>    

</head>  
<body>  
    
  <div class="easyui-layout" align=center style="width:100%;height:600px;overflow:hidden">    
  	
  	<div data-options="region:'north',split:true" style="width:100%;height:300px"> 
         <table id="dg"  class="easyui-datagrid" style="height:290px"  
                 url="/project/contractJob/joblist.do"  
                 toolbar="#toolbar" pagination="true"  
                 rownumbers="true" fitColumns="true" loadMsg="正在查询,请稍候..." singleSelect="true">  
        
         </table>  
     </div>
     <div data-options="region:'center',iconCls:'icon-ok'" style="width:100%"> 
              	<div id="tab_panel" class="easyui-tabs" style="height:250px">  
                         <div title="内部推荐记录" url="/project/contractJobCvRecom/jobRecomPage.do" style="padding:0px">  
                         
                             <iframe   name="tab_panel0" src="" style="margin-bottom:0;width:98%;height:99%"></iframe>  
                         </div>  
                         <div title="外部推荐记录" url="/project/contractJobCvRecom/jobRecomPage.do?isEmail=1" style="padding:0px">  
                             <iframe  name="tab_panel1" src="" style="width:98%;height:99%"></iframe>  
                         </div>  
                         <div title="客户面试记录" url="/project/contractJobCvInterview/managerPage.do" style="padding:0px">  
                             <iframe " name="tab_panel3" src="" style="width:98%;height:99%"></iframe> 
                         </div>
                         <div title="录用offer"  url="/project/contractJobCvOffer/jobOfferPage.do" style="padding:0px">  
                             <iframe  name="tab_panel4" src="" style="width:98%;height:99%"></iframe> 
                         </div>
                         <div title="背景调查" url="/project/contractJobCvBackground/managerPage.do" style="padding:0px">  
                             <iframe " name="tab_panel5" src="" style="width:98%;height:99%"></iframe>
                         </div>
                         <div title="成功候选人跟进" url="/project/contractJobCvCrm/managerPage.do" style="padding:0px">  
                             <iframe " name="tab_panel6" src="" style="width:98%;height:99%"></iframe>
                         </div>
                         <div title="职位附件" url="/project/contractJobAttachment/managerPage.do" style="padding:0px">  
                             <iframe " name="tab_panel7" src="" style="width:98%;height:99%"></iframe>
                         </div>
                         <div title="职位参与人" url="/project/contractJobPartner/managerPage.do" style="padding:0px">  
                             <iframe " name="tab_panel8" src="" style="width:98%;height:99%"></iframe>
                         </div>
                         <div title="JD人选" url="/project/contractJobCvJd/managerPage.do?type=1" style="padding:0px">  
                             <iframe " name="tab_panel9" src="" style="width:98%;height:99%"></iframe>
                         </div>
                </div> 
     </div>
  </div>  
    <div id="toolbar">  
        <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-add" plain="true" onclick="add()">新增</a>  
        <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-edit" plain="true" onclick="edit()">修改</a>  
        <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-remove" plain="true" onclick="deletes()">删除</a>  
        <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-search" plain="true" onclick="find()">查询</a>
    </div>  
    <div id="dlg" style="display:none;">
    	   <!--
            <iframe  src="/project/contractJob/info.do" style="width:99%;height:99%" scrolling="no"></iframe>
         -->   
    </div>     
    

    <!-- query form窗体(开始) -->  
    <div id="dlg_query" style="display:none;">
    	 <!--        
        <form id="fm_query" style="padding:5px" method="post" novalidate>  
            
              
	        		     <div class="fitem">  
                     <label style="width:100px">客户名:</label>                       
                     <input name="custName" class="easyui-box">                       
                   </div>	        		     	        		     	        		     
	        		     <div class="fitem">  
                     <label style="width:100px">职位名:</label>                                            
                     <input name="name" class="easyui-box">                       
                   </div> 
	        		     <div class="fitem">  
                     <label style="width:100px">一级行业:</label>                                            
        	 	  <input class="easyui-combobox" name="industry_parent" style="width:200px;"  data-options="data:__getCategoryByParant('INDUSTRY', 0),valueField:'id', textField:'codeNameCn', multiple:false,panelHeight:'auto',mode:'remote'
		             	,onSelect: function(rec){  
                         
                         $('#second_search_industry').combobox('loadData', __getCategoryByParant('INDUSTRY', rec.id));  
                         $('#second_search_industry').combobox('setValue',null);
                     }
		             	 ">
                   </div>      	      		     
        	  	   	 <div class="fitem">  
                     <label style="width:100px">二级行业:</label>                                            
                     <input class="easyui-combobox" id="second_search_industry" name="industry" style="width:200px;"  data-options="data:__getCategory('INDUSTRY'),valueField:'id', textField:'codeNameCn', multiple:false,panelHeight:'auto',mode:'remote' ">                     
                   </div> 
                   <div class="fitem">  
                     <label style="width:100px">一级职能:</label>                                            
                             	 	  <input class="easyui-combobox" name="function_parent" style="width:200px;"  data-options="data:__getCategoryByParant('JOB', 0),valueField:'id', textField:'codeNameCn', multiple:false,panelHeight:'auto',mode:'remote' 
		           	,onSelect: function(rec){              
                       $('#second_search_function').combobox('loadData', __getCategoryByParant('JOB', rec.id));  
                       $('#second_search_function').combobox('setValue',null);
                   }
		           	">
                   </div>      	
        	  	   	 <div class="fitem">  
                     <label style="width:100px">二级职能:</label>                                            
                     <input class="easyui-combobox" id="second_search_function" name="function" style="width:200px;"  data-options="data:__getCategory('JOB'),valueField:'id', textField:'codeNameCn', multiple:false,panelHeight:'auto',mode:'remote' ">                     
                   </div>      	
        	  	   	 <div class="fitem">  
                     <label style="width:100px">职级:</label>                                            
                                          
                     <input class="easyui-combobox" name="level" style="width:200px;"  data-options="data:__getCategory('JOBLEVEL'),valueField:'id', textField:'codeNameCn', multiple:false,panelHeight:'auto',mode:'remote' ">
                     
                   </div>      	
	        		     <div class="fitem">  
                     <label style="width:100px">职位负责人:</label>                                            
                     <input class="easyui-combobox" name="jobManager" style="width:200px;"  data-options="url:'/auth/systemUser/tuserlist.do',valueField:'account', textField:'name', multiple:false,panelHeight:'auto',mode:'remote' ">                       
                   </div> 
        	  	   	 <div class="fitem">  
                     <label style="width:100px">职位合作人:</label>                                            
                     
                     
                     <input class="easyui-combobox" name="jobCooper" style="width:200px;"  data-options="url:'/auth/systemUser/tuserlist.do',valueField:'account', textField:'name', multiple:false,panelHeight:'auto',mode:'remote' ">
                     
                   </div>      	
	        		     <div class="fitem">  
                     <label style="width:100px">职位参与人:</label>                       
                     <input class="easyui-combobox" name="jobPartner" style="width:200px;"  data-options="url:'/auth/systemUser/tuserlist.do',valueField:'account', textField:'name', multiple:false,panelHeight:'auto',mode:'remote' ">                      
                   </div>	        		     
	        		     <div class="fitem">  
                     <label style="width:100px">职位状态:</label>                       
                     <input class="easyui-combobox" name="status" style="width:200px;"  data-options="data:__getConstantCategory('JobStatus'),valueField:'code', textField:'value', multiple:false,panelHeight:'auto',mode:'remote' ">
                   </div>	        		     
              
        </form>  
        <div  style="text-align:center">  
          <a href="javascript:void(0)" id="btn-query" class="easyui-linkbutton" iconCls="icon-ok" ">查询</a>  
          <a href="javascript:void(0)" id="btn-query-close" class="easyui-linkbutton" iconCls="icon-cancel">关闭</a>  
        </div> 
        -->
    </div> 
    <!-- query form窗体(结束) -->  
 
 
    <script type="text/javascript">  
        var url;  
        var jobId=0;
        
        
        
        
        var optWin = $.window({
		       		 title:"新增内部新闻公告",
		       		 tplRef:"dlg",//这个属性指定模板id
		       		 height:550,	
		       		 width:1050,	       		 
		       		 closed:true,		       		 
		       		 onComplete:function(){
		       		 	  //窗口里面的初始化,最好是在这个事件里面进行
		       		 	  var curWin=this;
		       		 	  
		       		 	  var iframe= this.find("iframe");
		       		 	  
		       		 	   iframe.load(function(){
		       		 	  	  
		       		 	  	    iframe.contents().find("#btn-close").click(function(){		       		 	  	
		       		 	  	      curWin.window('close');
		       		 	        });
		       		 	  	    iframe[0].contentWindow.closeWin=function(){
					                      	curWin.window('close');
					                      	  
				                };
				                iframe[0].contentWindow.refresh=function(){
					           	   if(curWin.openerWin.refresh) curWin.openerWin.refresh();
				                };
		       		 	  	   
		       		 	  	  
		       		 	  });
		       		 	  
		       		 	 
		       		   
		       		 }
		    });
		    
         var queryWin = $.window({
		       		 title:"职位查询",
		       		 tplRef:"dlg_query",//这个属性指定模板id
		       		 height:400,		       		 
		       		 width:500,
		       		 closed:true,		       		 
		       		 onComplete:function(){
		       		 	  //窗口里面的初始化,最好是在这个事件里面进行
		       		 	  var curWin=this;
		       		 	  var doForm=curWin.find('#fm_query');
		       		 	  curWin.doForm=doForm;
		       		 	  this.find("#btn-query-close").click(function(){		       		 	  	
		       		 	  	   curWin.window('close');
		       		 	  });
		       		 	  this.find("#btn-query").click(function(){
		       		 	  			                 		  
		                 		 //var formdata=$('#fm_query').formToArray(); 
		                 		 curWin.window('close');
		                 		 var formdata=curWin.find('#fm_query').formToArray();   		 
		                 		 curWin.openWin.query(formdata);
		              });
		       		   
		       		 }
		    });
		    
        function add(){         	 
            //$('#dlg').dialog('open').dialog('setTitle','新增职位');  
            //$('#fm').form('clear');  
            //url = '/project/contractJob/save.do';  
            optWin.find('iframe')[0].contentWindow.location.href='/project/contractJob/info.do';
            optWin.find('iframe').scrolling="no";
            optWin.window('open'); 
            optWin.openerWin=window;    
            
                    
            
            //   tab.attr('url')+"?jobId="+jobId;
            optWin.window('setTitle','新增职位');
		      
        }  
        function doEdit(id){  
        	   optWin.find('iframe')[0].contentWindow.location.href='/project/contractJob/info.do?type=UPDATE&jobId='+id;    
        	   optWin.window('open');
		         optWin.openerWin=window;    
		         optWin.url='/talent/cvWork/update.do'; 
		         
		         optWin.window('setTitle','修改职位');
		             
        }	
        function edit(){  
            //var row = $('#dg').datagrid('getSelected');  
            var rows = $('#dg').datagrid('getSelections');
            if (!rows||rows.length==0){
            	 $.messager.alert('提示','请选择要修改的行','info');
            	 return;
            }
            if (!rows||rows.length>1){
            	 $.messager.alert('提示','不能选择多行','info');
            	 return;
            }
            if (rows){  
                //$('#dlg').dialog('open').dialog('setTitle','修改职位');  
                //$('#fm').form('load',rows[0]);  
                //$('#fm').form('load','/project/contractJob/get.do?id='+rows[0].id);  
                //url = '/project/contractJob/update.do';
                doEdit(rows[0].id);
            }  
        }  
        function save(){          	   
        	  if (!$('#fm').form('validate')) return; 
            $('#fm').form('submit',{  
                url: url,  
                onSubmit: function(){  
                    return $(this).form('validate');  
                },  
                success: function(result){  
                    var result = eval('('+result+')');  
                    console.log(result);
                    if (result.success == true){  
                        $.messager.alert('信息',result.msg,'info');  
                        $('#dlg').dialog('close');      // close the dialog  
                        $('#dg').datagrid('reload');    // reload the user data  
                    } else {  
                        $.messager.alert('错误',result.msg,'error');
                    }  
                }  
            });  
        }  
        function deletes(){  
            var row = $('#dg').datagrid('getSelected');  
            
            var rows = $('#dg').datagrid('getSelections');  

            if (!rows||rows.length==0){
            	 $.messager.alert('提示','请选择要删除的行','info');
            	 return;
            }
            if (rows){  
                $.messager.confirm('重要提示','确定要删除?',function(r){  
                    if (r){  
                        $.post('/project/contractJob/delete.do',{ids:getRecordArray(rows,'id').join(',')},function(result){  
                            if (result.success){  
                                $('#dg').datagrid('reload');    // reload the user data  
                            } else {  
                                 
                                $.messager.alert('错误',result.errorMsg,'error'); 
                            }  
                        },'json');  
                    }  
                });  
            }  
        }  
        function refresh(){        	
        	  $('#dg').datagrid('reload');
        }
        function find(){  
              
                queryWin.window('open');   
               queryWin.openWin=window; 
              
        } 
        	
        
         function query(formdata){  
                
                $('#dg').datagrid({
	                  queryParams: array2json(formdata)
                });
              
        }
        
        //生成grid的字段,需要字典的自动转换
        $('#dg').datagrid({
        	   columns:[[
        	   	        	   	
        	   	   {field:'jobNo',title:'职位编号', width:100}
        	   	   ,{field:'companyName',title:'客户', width:100}
        	   	   ,{field:'name',title:'职位名', width:100}
        	   	   ,{field:'dispLevel',title:'关注度', width:100}
        	   	   
        	   	   
        	   	   ,{field:'jobNature',title:'职位合作性质', width:100,
        	   		      formatter: function(value,row,index){
        	   		      	return __getConstantCategoryCodeValue('JOB_NATURE', value);
        	   		      },hidden : true
        	   	     }
        	   	     
        	   	   ,{field:'hrContacter',title:'客户职位联系人', width:100}  
        	   	   ,{field:'jobManager',title:'职位负责人', width:100}
        	   	   ,{field:'jobCooper',title:'职位合作人', width:100}
        	   	   ,{field:'creator',title:'创建人', width:100}
        	   	   ,{field:'createDt',title:'创建时间', width:100,hidden : true}
        	   	   ,{field:'days',title:'接单时长(天)', width:100,hidden : true}
        	   	   ,{field:'jobStatus',title:'职位进展', width:100}
        	   	   ,{field:'jdCount',title:'发JD数', width:100}
        	   	   
        	   	   ,{field:'recomCount',title:'推荐数', width:100}
        	   	   ,{field:'interviewCount',title:'客户面试数', width:100}
        	   	   ,{field:'backgroundCount',title:'背景调查', width:100}
        	   	   ,{field:'offerCount',title:'录用', width:100}
        	   	   ,{field:'workCount',title:'上班', width:100}        	   	   
        	   	   ,{field:'modifier',title:'修改人', width:100,hidden : true}
        	   	   ,{field:'modifiedDt',title:'修改时间', width:100,hidden : true}
        	   	
        	   	
        	   ]]
        	   ,onDblClickRow: function(rowIndex, rowData){
        	    	//$('#dlg').dialog('open').dialog('setTitle','修改职位');                  
                //$('#fm').form('load','/project/contractJob/get.do?id='+rowData.id);  
                //url = '/project/contractJob/update.do';    
                jobId=rowData.id;    	    	
                doEdit(jobId);
        	    }
        	   ,onClickRow: function(rowIndex, rowData){
        	    	
        	    	var tab = $('#tab_panel').tabs('getSelected');
        	      jobId=rowData.id;    
        	    	tab.find('iframe')[0].contentWindow.location.href=tab.attr('url')+"?jobId="+jobId+"&in=JOB";
                	    	
        	    } 
        }); 
        var selectedTab=0;
        //完成-生成grid的字段
        $('#dg').datagrid({
	            onLoadSuccess: function(data){		
              if(data.total&&data.total>0) {
              	  $('#dg').datagrid('selectRow',0);
              	  var rowData=$('#dg').datagrid('getSelected');
              	          	        
        	        jobId=rowData.id; 
        	        
        	        var tab=$('#tab_panel').tabs('getTab', selectedTab);
        	        tab.find('iframe')[0].contentWindow.location.href=tab.attr('url')+"?jobId="+jobId+"&in=JOB";
              }	
	          }
	       });
        //完成-生成grid的字段
         $('#tab_panel').tabs({
        	    onSelect: function(title,index){
        	    
        	    	var tab=$('#tab_panel').tabs('getTab', index);
        	      selectedTab=index;
        	       if (tab.attr('url')=='/project/contractJobCvRecom/jobRecomPage.do?isEmail=1')
        	       tab.find('iframe')[0].contentWindow.location.href=tab.attr('url')+"&jobId="+jobId+"&in=JOB";
        	      else 
        	    	  tab.find('iframe')[0].contentWindow.location.href=tab.attr('url')+"?jobId="+jobId+"&in=JOB";
        	    	
        	    	
        	    }
        }); 
        
        
    </script>  
     
     

     
     
     
</body>  
</html>